﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SWCInvoice.Enums;
using SWCInvoice.Model;

namespace SWCInvoice.Returntyps {
    /// <summary>
    /// Result of the AddEmptyPage method
    /// </summary>
    public class AddEmptyPageInfo : BaseInfo {
        #region Constanten

        /// Base object resource typ
        private const string RESOURCE_STRING = "AddEmptyPage";

        #endregion

        #region Fields                

        /// <summary>
        /// The page count
        /// </summary>
        private int _PageCount;

        #endregion

        #region Properties

        /// <summary>
        /// Base object resource typ
        /// </summary>        
        public override string ResourceString {
            get { return RESOURCE_STRING; }
        }        

        /// <summary>
        /// The page count
        /// </summary>
        public int PageCount {
            get { return _PageCount; }
            set { _PageCount = value; }
        }

        #endregion
     
        #region Construcctor

        public AddEmptyPageInfo() {
            
        }

        #endregion

        #region Methods

        public override MessageTyp SetMessageTypByObjectContent() {            
            if (PageCount == 0 && ExceptionList != null && ExceptionList.Count > 0)
                MessageTyp = MessageTyp.Error;
            else
                MessageTyp = MessageTyp.Information;

            return MessageTyp;
        }

        public override Message EnrichMessageWithParameters(Message message) {
            if (MessageTyp == MessageTyp.Warning || MessageTyp == MessageTyp.Information) {                
                message.Description = string.Format(message.Description, PageCount);                
            }  

            if (MessageTyp == MessageTyp.Error)
                message.Description = string.Format(message.Description, ExceptionList[0].Message);


            return message;
        }

        #endregion
    }
}
